export function add0(m) { return m < 10 ? `0${m}` : m; }
/** 时间戳转换时间 */
export function getLocalTime(nS, type) {
  if (nS) {
    nS = (nS+'').length > 10 ? nS : parseInt(nS, 10) * 1000;
    const time = new Date(parseInt(nS));
    const y = time.getFullYear();
    const m = time.getMonth() + 1;
    const d = time.getDate();
    const h = time.getHours();
    const mm = time.getMinutes();
    const s = time.getSeconds();
    if (type == 'YY-MM-DD'){
      return `${y}-${add0(m)}-${add0(d)}`;
    } else if (type == 'hh-mm-ss') {
      return `${add0(h)}:${add0(mm)}:${add0(s)}`;
    } else {
      return `${y}-${add0(m)}-${add0(d)} ${add0(h)}:${add0(mm)}:${add0(s)}`;
    }
  }
  return nS;
}